var expect = require('chai').expect;
var sinon = require('sinon');
var rewire = require('rewire');
var urlmappingController = rewire('../../controller/urlmappingController');

describe('test getKeyWordRegexs in urlmappingController.js', function () {
    it('should return regex [/shp/i] when given keywords shp', () => {
        //given
        var keywords = 'shp';
        var getKeyWordRegexs = urlmappingController.__get__('getKeyWordRegexs');
        //when
        var actualResult = getKeyWordRegexs(keywords);
        //then
        expect([/shp/i]).to.deep.equal(actualResult)
    });
    it('should return regex [/shp/i,/bl/i] when given keywords shp,bl', () => {
        //given
        var keywords = 'shp,bl';
        var getKeyWordRegexs = urlmappingController.__get__('getKeyWordRegexs');
        //when
        var actualResult = getKeyWordRegexs(keywords);
        //then
        expect([/shp/i,/bl/i]).to.deep.equal(actualResult)
    });
    it('should return regex [/shp;bl/i] when given keywords shp;bl', () => {
        //given
        var keywords = 'shp;bl';
        var getKeyWordRegexs = urlmappingController.__get__('getKeyWordRegexs');
        //when
        var actualResult = getKeyWordRegexs(keywords);
        //then
        expect([/shp;bl/i]).to.deep.equal(actualResult)
    });
});